/*************************************************************************
	> File Name: PluginManager.h
	> Author: 
	> Mail: 
	> Created Time: 2017年05月25日 星期四 03时14分53秒
 ************************************************************************/

#ifndef _PLUGINMANAGER_H
#define _PLUGINMANAGER_H
#include"./public/Plugin.h"

#include <uuid/uuid.h>
#include<vector>
#include <map>

typedef struct sEvent
{
	uuid_t *mUUID;
	int mPriority;
}struct_event;


typedef vector<struct_event*> eVect;

class PluginManager :public Plugin
{
private:
	PluginManager();
	void loadPlugin(const char* pluginPath);

public:
    int loadFilePlugin(const char *basePath);

    void Init();
    void sendEvent(JuzEvent *event);
    void registeredEvent(string eName,int priority,uuid_t *uid);
    void registeredPlugin(Plugin *pl);

    static PluginManager *getInstance();
private:
    static PluginManager 	*mPluginManager;

    map<uuid_t*,Plugin*>  	 mPluginList;
    map<string,eVect*>  	 mEventList;
};


bool SortBySe(struct_event *se1,struct_event *se2);
#endif
